package com.app.mapper;

import com.app.pojo.GasDetails;
import com.app.vo.UserBasicGasDetailVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 燃气详细信息 Mapper 接口
 * </p>
 *
 * @author yoominic
 * @since 2024-07-29
 */
@Mapper
public interface GasDetailsMapper extends BaseMapper<GasDetails> {


    Map<String, Object> selectSumMoneyAndGasTotal(@Param("account") String account,@Param("userId") Integer userId);

    /**
     * admin查询用户一些信息
     *
     * @param accountList
     * @return
     */
    List<UserBasicGasDetailVo> getUserBasicGasDetail(@Param("accountList") List<String> accountList);

    /**
     * Admin首页查询欠费账户数量
     * @return
     */
    Integer countArrearsUserNum();



    IPage<GasDetails> getGasDetailsInfoList(@Param("p") Page p, @Param("userId") Integer userId);

    @Select("select d.*\n" +
            "from tb_gas_details d\n" +
            "left join tb_public_announcement a on d.gas_number = a.gas_number\n" +
            "where a.id = #{personnelId}")
    GasDetails getGasDetailsByPersonnelId(Integer personnelId);
}
